package com.atguigu.day12.Test05;

public class Test05 {
    public static void main(String[] args) {
        User[] users = new User[15];
        for (int i = 0; i < users.length; i++) {
            users[i] = new User();
            users[i].setId(i + 1);
        }
//        Receptionist r1 = new Receptionist(new V1Filter());
//        Receptionist r2 = new Receptionist(new V2Filter());
//        Receptionist r3 = new Receptionist(new AFilter());
        for (int i = 0; i < users.length; i++) {
            if (i < 5)
                new Receptionist(new V1Filter() {
                    @Override
                    public void filterUser(User u) {
                        u.setUserType("v1");
                    }
                }).RecrptionistMethod(users[i]);
            else if (i < 10)
                new Receptionist(new V2Filter() {
                    @Override
                    public void filterUser(User u) {
                        u.setUserType("v2");
                    }
                }).RecrptionistMethod(users[i]);
            else
                new Receptionist(new AFilter() {
                    @Override
                    public void filterUser(User u) {
                        u.setUserType("A");
                    }
                }).RecrptionistMethod(users[i]);
        }
        for (int i = 0; i < users.length; i++) {
            System.out.println(users[i].toString());
        }
    }
}

//public class V1Filter implements Filter {
//
//    public void filterUser(User u) {
//        u.setUserType("v1");
//    }
//}